/**
 * Created by dukes on 2016/3/2.
 */
class GuildApplyItemRender extends eui.ItemRenderer {
    public constructor() {
        super();
        this.skinName = "skins.scene.elements.GuildApplyItemSkin";
    }

    private onAgree(evt:egret.TouchEvent){
        // if( GuildMgr.getInstance().guildInfo.shaikhId == Model.me.id){
        //     window["__dealApply"](this.data.userId, true);
        // }else{
            ShowHint("您不是族长");
        // }
    }

    private onRefuse(evt:egret.TouchEvent){
        // if( GuildMgr.getInstance().guildInfo.shaikhId == Model.me.id){
        //     window["__dealApply"](this.data.userId, false);
        // }else{
            ShowHint("您不是族长");
        // }
    }

    public dataChanged(){
        super.dataChanged();
        this.lab_name.text = LimitStringLen(this.data.userName);
        this.lab_level.text = this.data.petGradeSum+"";
    }

    private lab_name:eui.Label;
    private lab_level:eui.Label;
    private img_agree:eui.Image;
    private img_refuse:eui.Image;
    public partAdded(name:string, instance:any){
        super.partAdded(name,instance);
        if( name == "lab_name"){
            this.lab_name = instance;
        }else if( name == "lab_level"){
            this.lab_level = instance;
        }else if( name == "img_agree"){
            this.img_agree = instance;
            this.img_agree.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onAgree, this);
        }else if( name == "img_refuse"){
            this.img_refuse = instance;
            this.img_refuse.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onRefuse, this);
        }
    }
}